﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AvatarHelper;
using Avatar.Model;

namespace Avatar.Company
{
    public static class VipCompanyManager
    {
        /// <summary>
        /// 测试某个企业用户是否是VIP用户
        /// </summary>
        /// <param name="_userName">企业用户用户名</param>
        /// <returns></returns>
        public static bool IsVIP(string _userName)
        {
            var _vip = DBHelper.Get<VIPCompany>(vip=>vip.Company==_userName,"获取Vip用户出错:");
            
            bool _isVIP = false;
            if (_vip != null)
                _isVIP = true;
            
            return _isVIP;
        }
        public static DateTime GetVIPOverDate(string _userName)
        {
            var _vip = DBHelper.Get<VIPCompany>(vip => vip.Company == _userName, "获取Vip用户出错:");
            DateTime _overDate=DateTime.MinValue;
            if (_vip != null)
            {
                _overDate = _vip.BeginDate.AddMonths(_vip.Period.Month);
            }

            return _overDate;
        }
    }
}
